package se.cbb.scripts;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.ArrayList;

public class RemovingExtraClusters {

	public static void main(String[] args) {
		try {
			String path = "/Users/rhali/Documents/Projects/GrandOrthology/Sequences/";
			File folder = new File(path);
			File[] listOfFiles = folder.listFiles();
			ArrayList<File> temp = new ArrayList<File>();

			for(int i = 1; i < listOfFiles.length; i++) {
				String fileName = listOfFiles[i].getName();

				BufferedReader bufferedreader = new BufferedReader(new FileReader(path + fileName));
	
				int index = 0;

				while (bufferedreader.readLine() != null) {
					index++;
				}
				
				if (index < 10)
					temp.add(listOfFiles[i]);
				
				bufferedreader.close();
			}
			
			for(int j = 0; j < temp.size(); j++)
				temp.get(j).delete();
		} catch (Exception e) {
			System.out.println("Error : " + e.getMessage());
		}
		

	}

}
